//fetch each bit of integer, the a[0] store the low bit.
// like 2345,a[i] = {5,4,3,2};
#include <stdio.h>

int main(void)
{
    int num,i,cnt = 0, tmp, a[cnt];
    printf("Enter a number(num < 100000)\n");
    scanf("%d",&num);
    printf("The number is : %d\n",num);
    tmp = num;
    do
    {   a[cnt] = num % 10;
        num /= 10;
        cnt += 1;
    }while(num > 0);
    
    printf("bits of number is : %d\n", cnt);

    for(i = 0; i < cnt; i++)
    {
        a[i] = tmp % 10;
        printf("%d",a[i]);
        tmp /= 10;
    }
    return 0;
}
